﻿using System;
using System.Collections.Generic;
using System.Text;
using TigerAndGoats.Control;
using TigerAndGoats.Framework;
using TigerAndGoats.Resources;

namespace TigerAndGoats.Sprites
{
    public class DestinationGoatGroup: DestinationTip
    {
        public DestinationGoatGroup()
        {
            this._image = new System.Drawing.Bitmap(@"Resources\destinationTipGoatGroup.png");
        }

        public override void WalkToHere()
        {
            // 放下棋子（这个时候目标位置也会被清空，以及目标位置脱离绑定，不显示出来）
            FromPiece.PutDown();

            // 从羊群里挑一只羊放到当前位置
            var newGoat = new Goat();
            this._location.SetPiece(newGoat);

            // 羊群里减少一只羊
            GameControl.GoatsOnHand--;

            // 羊走完了，老虎走
            GameControl.currentRound = GameControl.Round.Tiger;
            ChequerGraph.RefreshUI();

            // 提前判断 老虎是否有路可走
            int? tigerNextSteps = GameControl.TigerA.SetCurrentActualReachablePaths();
            if (tigerNextSteps > 0)
            {
                GameControl.SetGeneralTip(UITipText.GAME_CONTINUE_WITH_MOVE_TIGER);
            }
        }
    }
}
